package com.hjwoo.app.adpter;/**
 * Create by ：rxiaowen on 2016/8/3 19:07
 * <p/>
 * Email：rxiaowen@sina.com
 */

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.hjwoo.app.R;
import java.util.ArrayList;



/**
 * Create by ：rxiaowen on 2016/8/3 19:07
 * Email：rxiaowen@sina.com
 */
public class TimeAdapter extends BaseAdapter {
    ArrayList datelist = new ArrayList();
    ViewHolder holder;
    Context context;
    public  TimeAdapter(ArrayList datelist, Context context){
        this.datelist = datelist;
        this.context = context;
    }
    @Override
    public int getCount() {
        return datelist.size();
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // 定义一个视图容器
        holder = null;
        if (convertView == null)
        {
            // 获取ViewHolder对象
            holder = new ViewHolder();
            // 导入布局并赋值给convertview
            convertView = View.inflate(context,R.layout.item_date,null);
            holder.tv_date = (TextView) convertView.findViewById(R.id.tv_date);
            holder.tv_date.setText(datelist.get(position)+"");
            convertView.setTag(holder);
        }
        else
        {
            // 取出holder
            holder = (ViewHolder) convertView.getTag();
        }
        return convertView;
    }
    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }


    public static class ViewHolder
    {
        public TextView tv_date;
    }
}
